
#ifndef TCPSERVER_H
#define TCPSERVER_H

#include <defs/global.h>
#include <QTcpServer>
#include <log4qt/logger.h>
#include "../connectionprovider.h"

class ServerTask;
namespace Optra{ namespace Engine{ namespace Server { namespace TcpServer {

	O_PRIVATE_DECLARE(TcpServer);
	class TcpServer : public ConnectionProvider
	{
		Q_OBJECT
		LOG4QT_DECLARE_QCLASS_LOGGER
	public:
		TcpServer(const QString& configKey, QObject *parent = 0);
		virtual ~TcpServer();

		//signals:

		public slots:
			void Start();

		

	private:
		O_PRIVATE_DECLARE_MEMBER(TcpServer);
	};

	class TcpServerPrivate : public QTcpServer
	{
		Q_OBJECT
		LOG4QT_DECLARE_QCLASS_LOGGER
	public:
		TcpServerPrivate();
		virtual ~TcpServerPrivate();	

		void start();

	protected:
		void incomingConnection(int socketDescriptor);

	private slots:
		
	private:
		bool disabled;
		int port;
	};

	typedef QSharedPointer<TcpServer> TcpServerPtr;

}}}}

#endif // TCPSERVER_H
